<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>四个偏移属性同时起作用</title>
    <style>
        /* 
        一个元素相对于父元素水平垂直居中。
         */
        .f{
            border: 1px solid #000;
            width: 300px;
            height: 300px;
            position: relative;
        }
        .s{
            position: absolute; 
            margin: auto;
            left: 10px;
            right: 10px;
            top: 10px;
            bottom: 10px;
            background-color: #00f;
        }
    </style>
</head>
<body>
    <div class="f">
        <div class="s">

        </div>
    </div>
</body>
</html>
